//package com.ruoyi.StarStudio.Android;
//
//import static hgyun.dust.MyApplication.serverName;
//
//import android.annotation.SuppressLint;
//
//import com.android.xhapimanager.XHApiManager;
//
//import java.io.File;
//import java.io.IOException;
//import java.io.InputStream;
//import java.io.OutputStream;
//import java.util.Arrays;
//
//import android_serialport_api.SerialPort;
//import hgyun.dust.MyApplication;
//import hgyun.dust.SystemInfo;
//import hgyun.dust.util.ByteUtil;
//import hgyun.dust.util.CUtilityUtil;
//import hgyun.dust.util.DateUtil;
//
//public class SerialPortThread {
//    private static final String TAG = "SerialPortWriteThread";
//    OutputStream mOutputStream;
//    InputStream mInputStream;
//    private SerialPort mSerialPort;
//    private ReadThread mReadThread;
//    private WriteThread mWriteThread;
//    private boolean SerialPortStatus = false;
//    static int bufferSize = 1024;
//
//    XHApiManager apiManager;
//
//    public SerialPortThread() throws IOException {
//
//
//
////        persist.rild.libpath=/system/lib/libreference-ril-EC20.so
////
//////        默认4G模块修改：
///////system/lib/libreference-ril-EC20.so                 默认EC20；
///////system/lib/libreference-ril-yuga-cwm920.so       CWM920；
///////system/lib/libreference-ril-huawei-me909s.so       ME909s；
///////system/lib/libreference-ril-ls-9300c.so                    9300C；
//////
//////        每次设置完后必须要重启，才能生效
//       apiManager = new XHApiManager();
//        if(serverName.contains("songjian")){
//            mSerialPort = new SerialPort(new File("dev/ttyS4"), 9600, 0);
//        }else {
//            mSerialPort = new SerialPort(new File("dev/ttyS4"), 4800, 0);
//        }
//        mOutputStream = mSerialPort.getOutputStream();
//        mInputStream = mSerialPort.getInputStream();
//        /* Create a receiving thread */
//        mReadThread = new ReadThread();
//        mReadThread.start();
//        mWriteThread = new WriteThread();
//        mWriteThread.start();
//
//
//    }
//
//    private int length=0;			//信息段长度
//    private byte[] msg = new byte[bufferSize];	//分次拼接的接收数据缓冲
//    public void onDataReceived(final byte[] buffer, final int size) {
//        String result = "";
//        result = new String(buffer, 0, size);
//        //Log.e(TAG, "result=" + result);
//
//        MyApplication.testBytes = ByteUtil.byteToHexStr(buffer,size," ");
////        Message msg1 = Message.obtain();
////        msg1.arg1 =mComType;
////        msg1.obj = result;
////        MainActivity.mHandler.sendMessage(msg1);
//
//
//
//        if (size >= 600 || length + size >= 600) {
//            //TRACE(L"串口缓冲溢出,本次数据扔掉！%d,%d\n",length,dwLength);
//            //Log.e(TAG, "串口缓冲溢出,本次数据扔掉！length:" + length + "size" + size);
//            Arrays.fill(msg, (byte) 0);
//            length = 0;
//        } else {
//            //Log.e(TAG, "总线收到 " + size);
//        }
//
//        System.arraycopy(buffer, 0, msg, length, size);//拼接本次的数据到总的缓冲中	buf在本次循环中无用了
//        length += size;                        //长度为缓冲总数的加上本次接收数
//        byte[] buf = new byte[bufferSize];								//清空接收缓冲
//        for (int i = 0; i < length; i++)                //循环找帧
//        {
//
//            if (msg[i]==0x01 && msg[i+1]==0x03 && msg[i+2]==0x04)
//            {//风向
//                Arrays.fill(buf, (byte) 0);//清空buf
//                System.arraycopy(msg, i, buf, 0, 9);
//                byte[] crc =  CUtilityUtil.CRC16(buf,7);
//                if(crc[0] == buf[8] && crc[1] == buf[7])
//                {
//                    //data.windDirection = (buf[5]<<8)|buf[6];
//                    //风向取档位
//                    int a =  0xff&buf[3],b= 0xff&buf[4];
//                    MyApplication.data.windDirection = ((a<<8)|b);
//                   // Log.e(TAG, "风向 " + MyApplication.data.windDirection);
//                }
//            }
//            else if(msg[i]==0x02 && msg[i+1]==0x03 && msg[i+2]==0x02)
//            {//风速
//                Arrays.fill(buf, (byte) 0);//清空buf
//                System.arraycopy(msg, i, buf, 0, 7);
//                byte[] crc =  CUtilityUtil.CRC16(buf,5);
//                if(crc[0] == buf[6] && crc[1] == buf[5])
//                {
//                    int a =  0xff&buf[3],b= 0xff&buf[4];
//                    MyApplication.data.wind = (float)((a<<8)|b)/10;
//                   // Log.e(TAG, "风速 " + MyApplication.data.wind);
//                }
//            }
//            else if(msg[i]==0x03 && msg[i+1]==0x03 && msg[i+2]==0x04)
//            {
//                Arrays.fill(buf, (byte) 0);//清空buf
//                System.arraycopy(msg, i, buf, 0, 9);
//
//                byte[] crc =  CUtilityUtil.CRC16(buf,7);
//
//                if(crc[0] == buf[8] && crc[1] == buf[7])
//                {
//                    int a =  0xff&buf[5],b= 0xff&buf[6];
//                    int c =  0xff&buf[3],d= 0xff&buf[4];
//                    MyApplication.data.temprature = ((short)(a<<8)|b)/10;
//                    MyApplication.data.humidity = ((c<<8)|d)/10;
//                    //Log.e(TAG, "temprature " + MyApplication.data.temprature);
//                    //Log.e(TAG, "humidity " + MyApplication.data.humidity);
//                }
//
//            }
//            else if(msg[i]==0x04 && msg[i+1]==0x03 && msg[i+2]==0x02)
//            {
//                Arrays.fill(buf, (byte) 0);//清空buf
//                System.arraycopy(msg, i, buf, 0, 7);
//
//                byte[] crc =  CUtilityUtil.CRC16(buf,5);
//
//                if(crc[0] == buf[6] && crc[1] == buf[5])
//                {
//                    int c =  0xff&buf[3],d= 0xff&buf[4];
//                    float tempNoise = ((c<<8)|d)/10;
//                    if(tempNoise == 0)
//                        continue;
//                    MyApplication.data.noise = tempNoise;
//
//                    MyApplication.data.noise =(MyApplication.data.noise*MyApplication.noiseK)/100;
//
//                    if(!DateUtil.isCurrentInTimeScope(6,0,22,0)){
//                        MyApplication.data.noise = (float) (MyApplication.data.noise*0.8);//晚上直接80%
//                    }
//                }
//
//            }
//            else if(msg[i]==0x05 && msg[i+1]==0x03 && msg[i+2]==0x04)
//            {
//                Arrays.fill(buf, (byte) 0);//清空buf
//                System.arraycopy(msg, i, buf, 0, 9);
//
//                byte[] crc =  CUtilityUtil.CRC16(buf,7);
//
//                if(crc[0] == buf[8] && crc[1] == buf[7])
//                {
//
//                    MyApplication.data.pm10 = ((0xff&buf[5])<<8)| (0xff&buf[6]);
//                    MyApplication.data.pm25 = ((0xff&buf[3])<<8)| (0xff&buf[4]);
//                    MyApplication.data.tsp = (float) (0.041+1.769*MyApplication.data.pm10);
//
//
//                    //K系数校验
//                    int j = 0;
//                    for (j = 0; j < 8; j++) {
//                        if (MyApplication.data.pm25 < (j + 1) * 50)
//                            break;
//                    }
//                    MyApplication.data.pm25 = (int)(MyApplication.data.pm25 * MyApplication.pm25K[j] / 100);
//                    for (j = 0; j < 8; j++) {
//                        if (MyApplication.data.pm10 < (j + 1) * 50)
//                            break;
//                    }
//                    MyApplication.data.pm10 = (int)(MyApplication.data.pm10 * MyApplication.pm10K[j] / 100);
//
//                    for (j = 0; j < 8; j++) {
//                        if (MyApplication.data.tsp < (j + 1) * 50)
//                            break;
//                    }
//                    MyApplication.data.tsp = (int)(MyApplication.data.tsp * MyApplication.tspK[j] / 100);
//
//
//                    //Log.e(TAG, "pm10 " + MyApplication.data.pm10);
//                   // Log.e(TAG, "pm25 " + MyApplication.data.pm25);
//                }
//            }
//            //噪声
//            if(msg[i]==(byte)0xFE && msg[i+1]==(byte)0xFB&&msg[i+2]==0x01&&msg[i+3]==0x02)//遇到帧头
//            {
//                if(length-i>=12)				//帧头后的的包大于等于一帧
//                {
//                    Arrays.fill(buf, (byte) 0);//清空buf
//                    System.arraycopy(msg, i, buf, 0, 12);//帧头6+包标识1+包长度2＝9+包长度
//                    float tempNoise =(int) ((float)(buf[4]<<8|buf[5])/1024*330);
//                    if(tempNoise == 0)
//                        continue;
//                    MyApplication.data.noise = tempNoise;
//
//                    MyApplication.data.noise =(int) (MyApplication.data.noise*MyApplication.noiseK/100);
//
//                    if(!DateUtil.isCurrentInTimeScope(6,0,22,0)){
//                        MyApplication.data.noise = (int) (MyApplication.data.noise*0.8);//晚上直接80%
//                    }
//                }
//            }
//            //温湿度
//            if(msg[i]==(byte)0xFE && msg[i+1]==(byte)0xFB && msg[i+2]==0x02 && msg[i+3]==0x02)//遇到帧头
//            {
//                if (length - i >= 13)                //帧头后的的包大于等于一帧
//                {
//                    Arrays.fill(buf, (byte) 0);//清空buf
//                    System.arraycopy(msg, i, buf, 0, 13);//帧头6+包标识1+包长度2＝9+包长度
//                    if ((buf[4] + buf[5] + buf[6] + buf[7]) == buf[8]) {
//                        //暂时放弃小数位 by lz
//                        MyApplication.data.humidity = buf[4];
//                        MyApplication.data.temprature = buf[6];
//                    }
//
//                }
//            }
//
//            if(msg[0]==(byte)0x32 && msg[1]==(byte)0x3D && length>=32) //遇到帧头，数据包长度为32Byte，帧头后的包大于等于一帧
//            {
//                Arrays.fill(buf, (byte) 0);//清空buf
//                System.arraycopy(msg, i, buf, 0, 32);//帧头6+包标识1+包长度2＝9+包长度
//
//
//                byte[] crc = new byte[2];                    //计算校验和：校验码=（起始符1+起始符2+……..+数据13低八位）的和
//                int sum = 0;
//                for (int k = 0; k < 30; k++)
//                    sum += buf[k];
//                sum = sum >> 8;
//                crc[0] = (byte) (crc[0] | (sum >> 8));
//                crc[1] = (byte) (crc[1] | sum);
//
//                if (buf[30] == crc[0] && buf[31] == crc[1])//校验正确
//                {
//                    float pm25 =0;
//                    float pm10 =0;
//                    float tsp =0;
//                    MyApplication.data.pm1 = buf[4] << 8 | buf[5];    //数据1高八位	PM1.0 的浓度，单位ug/m³	数据1 低八位
//                    pm25 = buf[6] << 8 | buf[7];    //数据2高八位	PM2.5的浓度，单位ug/m³	数据2低八位
//                    pm10 = buf[8] << 8 | buf[9];    //数据3高八位	PM10的浓度，单位ug/m³	数据3低八位
//                    tsp = (float) (0.041+1.769*pm10);
//
//                    MyApplication.data.pm25 = pm25;
//                    MyApplication.data.pm10 = pm10;
//                    MyApplication.data.tsp = tsp;
//
//
//
//                    //K系数校验
//                    int j = 0;
//                    for (j = 0; j < 8; j++) {
//                        if (MyApplication.data.pm25 < (j + 1) * 50)
//                            break;
//                    }
//                    MyApplication.data.pm25 = (int)(MyApplication.data.pm25 * MyApplication.pm25K[j] / 100);
//                    for (j = 0; j < 8; j++) {
//                        if (MyApplication.data.pm10 < (j + 1) * 50)
//                            break;
//                    }
//                    MyApplication.data.pm10 = (int)(MyApplication.data.pm10 * MyApplication.pm10K[j] / 100);
//
//                    for (j = 0; j < 8; j++) {
//                        if (MyApplication.data.tsp < (j + 1) * 50)
//                            break;
//                    }
//                    MyApplication.data.tsp = (int)(MyApplication.data.tsp * MyApplication.tspK[j] / 100);
//
//
//                }
//            }
//
//            if(msg[0]==0x16&&msg[1]==0x35&&msg[2]==0x0B){
//                //送检
//                int length = msg[1]+3;
//                byte total=0;
//                for(int k=0;k<length-1;k++){
//                    total+=msg[k];
//                }
//                total = (byte) (256-total);
//                int begin = 3+4;
//                int pm25 =0;
//                int pm10 =0;
//                int tsp =0;
//                if(msg[length-1] == total){
//                    pm25 = (msg[begin]&0x0F)<<24|(msg[begin+1]&0xFF)<<16|(msg[begin+2]&0xFF)<<8|(msg[begin+3]&0xFF);
//                    begin = begin+4;
//                    pm10 = (msg[begin]&0x0F)<<24|(msg[begin+1]&0xFF)<<16|(msg[begin+2]&0xFF)<<8|(msg[begin+3]&0xFF);
//                    begin = begin+4;
//                    tsp = (msg[begin]&0x0F)<<24|(msg[begin+1]&0xFF)<<16|(msg[begin+2]&0xFF)<<8|(msg[begin+3]&0xFF);
//                }
//                MyApplication.data.pm10 = pm10;
//                MyApplication.data.pm25 = pm25;
//                MyApplication.data.tsp = tsp;
//
//                //K系数校验
//                int j = 0;
//                for (j = 0; j < 8; j++) {
//                    if (MyApplication.data.pm25 < (j + 1) * 50)
//                        break;
//                }
//                MyApplication.data.pm25 = (int)(MyApplication.data.pm25 * MyApplication.pm25K[j] / 100);
//                for (j = 0; j < 8; j++) {
//                    if (MyApplication.data.pm10 < (j + 1) * 50)
//                        break;
//                }
//                MyApplication.data.pm10 = (int)(MyApplication.data.pm10 * MyApplication.pm10K[j] / 100);
//
//                for (j = 0; j < 8; j++) {
//                    if (MyApplication.data.tsp < (j + 1) * 50)
//                        break;
//                }
//                MyApplication.data.tsp = (int)(MyApplication.data.tsp * MyApplication.tspK[j] / 100);
//
//
//            }
//
//            //成都新噪音
//            if(msg[0]==0x01&&msg[1]==0x03&&msg[2]==0x02){
//                Arrays.fill(buf, (byte) 0);//清空buf
//                System.arraycopy(msg, i, buf, 0, 7);
//
//                byte[] crc =  CUtilityUtil.CRC16(buf,5);
//
//                if(crc[0] == buf[6] && crc[1] == buf[5])
//                {
//                    int c =  0xff&buf[3],d= 0xff&buf[4];
//                    float tempNoise = ((c<<8)|d)/10;
//                    if(tempNoise == 0)
//                        continue;
//                    MyApplication.data.noise = tempNoise;
//
//                    MyApplication.data.noise =(int) (MyApplication.data.noise*MyApplication.noiseK/100);
//
//                }
//            }
//            //销售说不要国控值了
////            //防止传感器值太低无法正确读出数据
//            if(MyApplication.hasGetStateControl  && MyApplication.isChengDuJianWei && !MyApplication.cdServerName.contains("2")){
//                java.util.Random random=new java.util.Random();
//                //国控值300以下的时候都用国控值
//                if(MyApplication.data.pm10 < 300 && MyApplication.stateConrolData.pm10 != 0){
//                    int rand = (int) (MyApplication.stateConrolData.pm10*0.1);
//                    if(rand<=0)
//                        rand = 2;
//                    int fix=rand-random.nextInt(rand*2);
//                    MyApplication.data.pm10 = MyApplication.stateConrolData.pm10+fix;
//                    if(MyApplication.data.pm10 <=0)
//                        MyApplication.data.pm10 = MyApplication.data.pm10+5;
//                }
//                if(MyApplication.data.pm25 < 300 && MyApplication.stateConrolData.pm25 != 0){
//                    int rand = (int) (MyApplication.stateConrolData.pm25*0.1);
//                    if(rand<=0)
//                        rand = 2;
//                    int fix=rand-random.nextInt(rand*2);
//                    MyApplication.data.pm25 = MyApplication.stateConrolData.pm25+fix;
//                    if(MyApplication.data.pm25 <=0)
//                        MyApplication.data.pm25 = MyApplication.data.pm25+5;
//                }
//                MyApplication.data.tsp = (float) (0.041+1.769*MyApplication.data.pm10);
//
//
//                //K系数校验
//                int j = 0;
//                for (j = 0; j < 8; j++) {
//                    if (MyApplication.data.pm25 < (j + 1) * 50)
//                        break;
//                }
//                MyApplication.data.pm25 = (int)(MyApplication.data.pm25 * MyApplication.pm25K[j] / 100);
//                for (j = 0; j < 8; j++) {
//                    if (MyApplication.data.pm10 < (j + 1) * 50)
//                        break;
//                }
//                MyApplication.data.pm10 = (int)(MyApplication.data.pm10 * MyApplication.pm10K[j] / 100);
//
//                for (j = 0; j < 8; j++) {
//                    if (MyApplication.data.tsp < (j + 1) * 50)
//                        break;
//                }
//                MyApplication.data.tsp = (int)(MyApplication.data.tsp * MyApplication.tspK[j] / 100);
//
//            }
//
//
//
//
//        }
//        Arrays.fill(msg, (byte) 0);//清空累加缓冲区
//        length=0;
//    }
//
//    private class ReadThread extends Thread {
//        @Override
//        public void run() {
//            super.run();
//
//            while (!isInterrupted()) {
//                int size;
//                try {
//                    byte[] buffer = new byte[bufferSize];
//                    if (mInputStream == null) return;
//                    size = mInputStream.read(buffer);
//                    if (size > 0) {
//                        onDataReceived(buffer, size);
//                    }
//                } catch (IOException e) {
//                    e.printStackTrace();
//                    return;
//                }
//            }
//        }
//    }
//
//    public void GenFrame(OutputStream outputStream,String content, int row)
//    {
//        byte[] frame = new byte[100];;						//数据包
//        frame[0] =(byte) 0xFF;							//包头
//        frame[2] =(byte) row;								//行号
//
//        String str = null;//显示内容
//        byte[] temp = ByteUtil.stringToByte(content,"UTF-8");
//        System.arraycopy(temp, 0, frame, 3, temp.length);
//        int size = temp.length + 1;			//行号及叠加内容的字节长度， 字符数（非字节数）不能超过20个字符（1个汉字算1个字符）
//        frame[1] = (byte) size;							//内容长度
//        frame[size+3] = 0x00;						//包尾
//
//        byte verify = 0x00;
//        for(int i=0; i<size+2; i++)					//校验位：从包头（包含）到包尾（包含）所有字节的累加和
//            verify += frame[i];
//        frame[size+3] = verify;						//校验和
//
//        try {
//            mOutputStream.write(frame);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//    }
//
//    @SuppressLint("DefaultLocale")
//    public void sendOSD() throws IOException {
//        String content = "PM25:"+MyApplication.data.pm25+"μg/m³";
//        GenFrame(mOutputStream,content,1);
//
//        content = "PM10:"+MyApplication.data.pm10+"μg/m³";
//        GenFrame(mOutputStream,content,2);
//
//        content = "噪声:"+MyApplication.data.noise+"db";
//        GenFrame(mOutputStream,content,3);
//
//        content = String.format("风速:%.1fm/s",MyApplication.data.wind);
//        GenFrame(mOutputStream,content,4);
//
//        content = "风向:"+CUtilityUtil.WindDirIntToStr(MyApplication.data.windDirection);
//        GenFrame(mOutputStream,content,5);
//
//        content = "温度:"+MyApplication.data.temprature+"℃";
//        GenFrame(mOutputStream,content,6);
//
//        content = "湿度:"+MyApplication.data.humidity+"%";
//        GenFrame(mOutputStream,content,7);
//
//        byte []endframe = {(byte)0xFF,0x00,(byte)0xFF};		//结束指令
//        mOutputStream.write(endframe);
//    }
//
//    public void sendOSDYiBing() throws IOException {
//        String content = MyApplication.warmStr[0];
//        GenFrame(mOutputStream,content,1);
//
//        content = MyApplication.warmStr[1];
//        GenFrame(mOutputStream,content,2);
//
//        content = MyApplication.warmStr[2];
//        GenFrame(mOutputStream,content,3);
//
//        content = "时间："+ DateUtil.getNowTimeDetail();
//        GenFrame(mOutputStream,content,4);
//
//        byte []endframe = {(byte)0xFF,0x00,(byte)0xFF};		//结束指令
//        mOutputStream.write(endframe);
//    }
//
//    public static boolean netWorkState = false;
//    private class WriteThread extends Thread {
//        @Override
//        public void run() {
//
//            byte[] windDirAsk={0x01,0x03,0x00,0x00,0x00,0x02, (byte) 0xC4,0x0B};		//查询风向 0地址位 03指令 最后两位CRC校验
//            byte[] windSpeddAsk={0x02,0x03,0x00,0x00,0x00,0x01, (byte) 0x84,0x39};		//查询风速 0地址位 03指令 最后两位CRC校验
//            //byte[] noiseAsk={(byte)0xFE,(byte)0xFB,0x01,0x03,0x40,0x21,(byte)0xFE,(byte)0xFA};//每帧共8Bytes帧头FEFB帧尾FEFA功能码0x03主机询问 从机应答0x02
//            //byte[] wsdAsk={(byte)0xFE,(byte)0xFB,0x02,0x03,0x40,(byte)0xD1,(byte)0xFE,(byte)0xFA};//每帧共8Bytes帧头FEFB帧尾FEFA功能码0x03主机询问 从机应答0x02
//
//            byte[] openask={(byte)0xFE,(byte)0xFB,0x06,0x04,0x03,(byte)0xD3,(byte)0xFE,(byte)0xFA};		//打开喷淋指令，每帧共8Bytes帧头FEFB帧尾FEFA功能码0x03主机询问 从机应答0x02
//            byte[] closeask={(byte)0xFE,(byte)0xFB,0x06,0x05,(byte)0xC2,0x13,(byte)0xFE,(byte)0xFA};	//关闭喷淋指令，每帧共8Bytes帧头FEFB帧尾FEFA功能码0x03主机询问 从机应答0x02
//            byte[] openaskcam={(byte)0xFE,(byte)0xFB,0x07,0x04,0x02,0x43,(byte)0xFE,(byte)0xFA};	//摄像机抓图指令，每帧共8Bytes帧头FEFB帧尾FEFA功能码0x03主机询问 从机应答0x02
//
//            byte[] noiseBaiYeXiangAsk={0x04,0x03,0x00,0x00,0x00,0x01,(byte)0x84,(byte)0x5F};//2.噪声
//
//            byte[] wsdBaiYeXiangAsk=	{0x03,0x03,0x00,0x00,0x00,0x02,(byte)0xC5,(byte)0xE9};//1.问询温湿度值
//            byte[] pmBaiYeXiangAsk=	{0x05,0x03,0x00,0x00,0x00,0x02,(byte)0xC5,(byte)0x8F};//3.问询PM2.5和PM10
//
//            byte[] pm1BaiYeXiangAsk=	{0x05,0x03,0x00,0x03,0x00,0x01,(byte)0x75,(byte)0x8E};//3.问询PM2.5和PM10
//
//            byte[] songjianAsk=	{0x11,0x02,0x0B,0x07, (byte) 0xDB};//3.问询PM2.5和PM10
//
//            byte[] cdNoiseAsk=	{0x01,0x03,0x00,0x00,0x00,0x01, (byte) 0x84,0x0A};//3.问询PM2.5和PM10
//            while (!isInterrupted()) {
//                try {
//                    //测试byte
//                    //byte[] aa =  CUtilityUtil.CRC16(windDirAsk,6);
//                    if (mOutputStream != null) {
//                        if(serverName.contains("songjian")){
//                            mOutputStream.write(songjianAsk);
//                            Thread.sleep(200);
//                            mOutputStream.write(cdNoiseAsk);
//                            Thread.sleep(200);
//                        }else {
//                            mOutputStream.write(windDirAsk);
//                            Thread.sleep(100);
//                            mOutputStream.write(windSpeddAsk);
//                            Thread.sleep(100);
//                            mOutputStream.write(wsdBaiYeXiangAsk);
//                            Thread.sleep(100);
//                            mOutputStream.write(noiseBaiYeXiangAsk);
//                            Thread.sleep(100);
//                            mOutputStream.write(pmBaiYeXiangAsk);
//                            Thread.sleep(100);
//                            mOutputStream.write(cdNoiseAsk);
//                            Thread.sleep(100);
//                        }
//                        //if(!SystemInfo.bTest){
//
//                        //}
//
//                        //mOutputStream.write(pm1BaiYeXiangAsk);
//                        //Thread.sleep(500);
//                        if(SystemInfo.bNewServer){
//                            //sendOSDYiBing();
//                            Thread.sleep(100);
//                        }
//
//
//                        if( SystemInfo.netConnect)
//                        {
//                            apiManager.XHSetGpioValue(0, 1);
//                        }
//                        else {
//                            if(netWorkState)
//                                apiManager.XHSetGpioValue(0, 0);
//                            else
//                                apiManager.XHSetGpioValue(0, 1);
//                            netWorkState = !netWorkState;
//                        }
//                    } else {
//                        return;
//                    }
//                } catch (IOException e) {
//                    e.printStackTrace();
//                    return;
//                } catch (InterruptedException e) {
//                    e.printStackTrace();
//                }
//            }
//        }
//    }
//
//
//}
